import http from "../request.js";
const header = {
	"Content-Type": "application/x-www-form-urlencoded"
};

class BaseCenter {
	constructor() {
		this.authLogin_Api = "/api/user/auth_login" // 微信小程序授权注册账号
		this.sendcode_Api = "/api/sms/juhesend"; // 验证码
		this.upload_Api = "/api/user/upload"; // 图片上传
		this.pwdLoginApi = "/api/user/login"; // 账号密码登录
		this.mobileloginApi = "/api/user/mobilelogin"; // 手机快捷登录
		this.wxLoginApi = "/api/user/wechat_login"; // 微信登录
		this.miniappLoginApi = "/api/user/miniapp_login"; // 微信授权登录
		this.miniappAuthApi = "/api/user/miniapp_auth"; // 微信绑定
		this.wechaBindMobileApi = "/api/user/wechat_bind_mobile"; // 微信登录-绑定手机号接口
		this.registerApi = "/api/user/register"; // 注册
		this.logoutApi = "/api/user/logout"; // 退出登录
		this.getinfo_Api = "/api/user/getinfo"; // 个人资料
		this.changesexApi = "/api/user/changesex"; // 修改性别
		this.changeBirthApi = "/api/user/changeBirth"; // 修改生日
		this.changeavatarApi = "/api/user/changeavatar"; // 修改头像
		this.changenickApi = "/api/user/changenick"; // 修改昵称
		this.changemobileApi = "/api/user/changemobile"; // 修改手机号码
		this.uppassApi = "/api/user/uppass"; // 重置登录密码
		this.uppaypswApi = "/api/user/uppaypsw"; // 重置支付密码
		this.resetpwdApi = "/api/user/resetpwd"; // 忘记密码、找回密码
		this.getActivityImgApi = "/api/user/getActivityImg"; // 邀请海报
		this.getAgreementApi = "/api/user/getAgreement"; // 协议接口

		this.addressList_Api = "/api/hqshop/adress/lists"; // 收货地址列表
		this.adressdetail_Api = "/api/hqshop/adress/detail"; // 地址详情
		this.adressEdit_Api = "/api/hqshop/adress/edit"; // 编辑地址
		this.addressadd_Api = "/api/hqshop/adress/add"; // 添加收货地址
		this.adressDel_Api = "/api/hqshop/adress/del"; // 删除地址
		this.defaultaddress_Api = "/api/hqshop/adress/setdefault"; // 设置默认地址  

		this.getAreaApi = '/api/index/getArea'; // 获取地区信息

		this.do_recharge_Api = "/api/hqshop/recharge/do_recharge"; // 余额充值  
		this.experience_Api = "/addons/epay/index/experience"; // 微信支付宝支付  
		this.huifuPay_Api = "/api/huifu/pay"; // 微信支付宝支付  

		this.banner_list_api = "/api/banner/banner_list"; // 轮播图
		this.getTitlesApi = "/api/notice/getTitles"; // 公告
		this.getNoticDetail_Api = "/api/notice/details"; // 公告详情
		this.addMerch2_Api = "/api/hqmerch/apply/addMerch2"; // 事业部申请


		this.miniapp_auth_Api = "/api/user/miniapp_auth"; // 新微信接口
		this.auth_login_Api = "/api/user/auth_login"; // 微信小程序授权注册
		this.app_wechat_login_Api = "/api/user/app_wechat_login"; // 微信小程序授权登录
		this.getMobile_Api = "/api/user/getMobile"; // 微信小程序获取手机号

		this.huifuWxPayApi = '/api/huifu/wechatminiPay2'  //汇付微信支付
	}

	sendcode(params) { // 图片上传
		return http.post(this.sendcode_Api, params || {}).then((res) => res.data);
	}
	upload(params) { // 图片上传
		return http.post(this.upload_Api, params || {}).then((res) => res.data);
	}
	pwdLogin(data) {
		return http.post(this.pwdLoginApi, data, {
			header
		}).then((res) => res.data);
	}
	wxLogin(data) {
		return http.post(this.wxLoginApi, data, {
			header
		}).then((res) => res.data);
	}
	miniappAuth(data) {
		return http.post(this.miniappAuthApi, data, {
			header
		}).then((res) => res.data);
	}
	miniappLogin(data) {
		return http.post(this.miniappLoginApi, data, {
			header
		}).then((res) => res.data);
	}
	wechaBindMobile(data) {
		return http.post(this.wechaBindMobileApi, data, {
			header
		}).then((res) => res.data);
	}
	mobilelogin(data) {
		return http.post(this.mobileloginApi, data, {
			header
		}).then((res) => res.data);
	}
	register(params) {
		return http.post(this.registerApi, params, {
			header
		}).then((res) => res.data);
	}
	logOut(params) { // 退出登录
		return http.post(this.logoutApi, params || {}).then((res) => res.data);
	}
	sendRegisterCode(params) {
		return http.post(this.sendRegisterCodeApi, params, {
			header
		}).then((res) => res.data);
	}
	getInfo(params) { // 个人资料
		return http.post(this.getinfo_Api, params || {}).then((res) => res.data);
	}
	changesex(params) { // 修改性别
		return http.post(this.changesexApi, params || {}).then((res) => res.data);
	}
	changeBirth(params) { // 修改生日
		return http.post(this.changeBirthApi, params || {}).then((res) => res.data);
	}
	changeavatar(params) { // 个人头像
		return http.post(this.changeavatarApi, params || {}).then((res) => res.data);
	}
	changenick(params) { // 修改昵称
		return http.post(this.changenickApi, params || {}).then((res) => res.data);
	}
	changemobile(params) { // 修改手机号码
		return http.post(this.changemobileApi, params || {}).then((res) => res.data);
	}
	uppass(params) { // 重置登录密码
		return http.post(this.uppassApi, params || {}).then((res) => res.data);
	}
	uppaypsw(params) { // 重置支付密码
		return http.post(this.uppaypswApi, params || {}).then((res) => res.data);
	}
	resetpwd(params) { // 忘记密码、找回密码
		return http.post(this.resetpwdApi, params || {}).then((res) => res.data);
	}
	getActivityImg(params) { // 邀请海报
		return http.post(this.getActivityImgApi, params || {}).then((res) => res.data);
	}
	do_recharge(params) { // 
		return http.post(this.do_recharge_Api, params || {}).then((res) => res.data);
	}
	experience(params) { //
		return http.post(this.experience_Api, params || {}, {
			header
		}).then((res) => res.data);
	}
	huifuPay(params) { //
		return http.post(this.huifuPay_Api, params || {}, {
			header
		}).then((res) => res.data);
	}

	addressList(params) { // 收货地址列表
		return http.post(this.addressList_Api, params || {}).then((res) => res.data);
	}
	adressdetail(params) { // 地址详情
		return http.post(this.adressdetail_Api, params || {}).then((res) => res.data);
	}
	adressEdit(params) { // 编辑地址
		return http.post(this.adressEdit_Api, params || {}).then((res) => res.data);
	}
	addressadd(params) { // 添加收货地址
		return http.post(this.addressadd_Api, params || {}).then((res) => res.data);
	}
	adressDel(params) { // 删除地址
		return http.post(this.adressDel_Api, params || {}).then((res) => res.data);
	}
	defaultaddress(params) { // 设置默认地址
		return http.post(this.defaultaddress_Api, params || {}).then((res) => res.data);
	}
	defaultaddress(params) { // 
		return http.post(this.defaultaddress_Api, params || {}).then((res) => res.data);
	}
	
	bankList(params) { // 用户银行卡列表
		return http.post('/api/withdraw/getUserBankList', params || {}).then((res) => res.data);
	}
	bankAdd(params) { // 用户银行卡添加
		return http.post('/api/withdraw/bankAdd', params || {}).then((res) => res.data);
	}
	bankEdit(params) { // 用户银行卡编辑
		return http.post('/api/withdraw/bankEdit', params || {}).then((res) => res.data);
	}
	bankDel(params) { // 用户银行卡删除
		return http.post('/api/withdraw/bankDel', params || {}).then((res) => res.data);
	}
	bankDetail(params) { // 用户银行卡详情
		return http.get('/api/withdraw/bankDetail?id='+params.id).then((res) => res.data);
	}
	submitRealName(params) { // 提交实名认证
		return http.post('/api/withdraw/submitRealName',params || {}).then((res) => res.data);
	}
	realName(params) { // 提交实名认证
		return http.post('/api/withdraw/realName',params || {}).then((res) => res.data);
	}
	
	getHuifuConfig(params) { // 获取汇付银行列表及地区列表
		return http.post('/api/withdraw/getHuifuConfig', params || {}).then((res) => res.data);
	}

	getAreaInfo(params) { // 获取地区信息
		return http.post(this.getAreaApi, params || {}).then((res) => res.data);
	}

	getBannerList(params) { // 轮播图
		return http.post(this.banner_list_api, params || {}).then((res) => res.data);
	}
	getNoticList(params) { // 公告
		return http.post(this.getTitlesApi, params || {}).then((res) => res.data);
	}
	getNoticDetail(params) { // 公告详情
		return http.post(this.getNoticDetail_Api, params || {}).then((res) => res.data);
	}
	addMerch2(params) { // 事业部申请
		return http.post(this.addMerch2_Api, params || {}).then((res) => res.data);
	}



	// 新的微信登录接口  23/9/5
	miniapp(params) { // app 绑定微信 （新）
		return http.post(this.miniapp_auth_Api, params || {}).then((res) => res.data);
	}
	authLogin(params) { // 微信小程序注册
		return http.post(this.auth_login_Api, params || {}).then((res) => res.data);
	}
	appWechatLogin(params) { // 微信小程序授权登录
		return http.post(this.app_wechat_login_Api, params || {}).then((res) => res.data);
	}
	newGetMobil(params) { // 微信小程序获取手机号
		return http.post(this.getMobile_Api, params || {}).then((res) => res.data);
	}

	huifuWxPay(params) { // 汇付微信支付
		return http.post(this.huifuWxPayApi, params || {}).then((res) => res.data);
	}
}

export const BaseCenterApi = new BaseCenter();